import 'package:easy_refresh/easy_refresh.dart';
import 'package:flutter/material.dart';
import 'package:situation/app/page/publish/publish_index/widget/task_list_item.dart';
import 'package:situation/data/request/intell_request.dart';
import 'package:tdesign_flutter/tdesign_flutter.dart';

class TaskPage extends StatefulWidget {
  const TaskPage({super.key});

  @override
  State<TaskPage> createState() => _TaskPageState();
}

class _TaskPageState extends State<TaskPage> with TickerProviderStateMixin {
  late TabController tabController;

  @override
  void initState() {
    // TODO: implement initState
    super.initState();
    tabController = TabController(length: 4, vsync: this);

    getData();
  }

  getData() async {
    await IntellRequest.getMyTaskList(1, 10, 1);
  }

  @override
  Widget build(BuildContext context) {
    return Column(
      children: [
        TDTabBar(
          tabs: [
            TDTab(text: '未处理'),
            TDTab(text: '进行中'),
            TDTab(text: '已完成'),
            TDTab(text: '拒绝'),
          ],
          controller: tabController,
          backgroundColor: Colors.white,
          showIndicator: true,
        ),
        Expanded(
          child: TabBarView(
            controller: tabController,
            children: [
              TaskListItem(status: -1),
              TaskListItem(status: 1),
              TaskListItem(status: 2),
              TaskListItem(status: 3),
            ],
          ),
        ),
      ],
    );
  }
}
